<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
    <div id="app"></div>
  <template id="my-app">
  <h2>选择你喜欢的城市</h2>
  <select v-model="city">
  <option value="">==请选择城市==</option>
  <option v-for="item in loveCities"
  :value="item.value">{{item.text}}</option>
  </select>
  <div>
  你喜欢：{{city}}
  </div>
</template>
<script src="../lib/js/vue.js"></script>
<script>
const app = Vue.createApp({
template: '#my-app',
data: function () {
return {
// 来自服务器的数据
loveCities: [
{ value: '南京', text: '南京市' },
{ value: '杭州', text: '杭州市' },
{ value: '重庆', text: '重庆市' },
{ value: '成都', text: '成都市' }],
city: ''
}
}
})
app.mount('#app')
</script>
</body>
</html>


